<?php

class MetaField {
	private $metaclass;
	public function SetMetaClass(MetaClass $value){ $this->metaclass = $value; }
	public function GetMetaClass(){ return $this->metaclass; }
	
	private $name;
	public function GetName(){ return $this->name; }
	public function SetName($value){ $this->name = $value; }
	
	private $type;
	private function __construct($type){ $this->type = $type; }
	public function GetType(){ return $this->type; }
	
	private $alias;
	public function GetAlias(){ return $this->alias; }
	public function WithAlias($value){$this->alias=$value;return $this;}
	public function GetDBFieldName(){ return $this->alias==null ? $this->name : $this->alias;	}

	private $label;
	public function GetLabel(){ return $this->label; }
	public function WithLabel($args){
		if ($args instanceof Lemma)
			$this->label = $args;
		else {
			$a = func_get_args();
      $z = func_num_args();
      if ($z == 1)
        $this->label = Lemma::Retrieve($a[0]);
      else
			  $this->label = new Lemma($a);
		}
		return $this;
	}
	
	private $is_volatile = false;
	public function WithIsVolatile($value){$this->is_volatile=$value;return $this;}
	public function IsVolatile(){ return $this->is_volatile; }
	
	
	
	
	public static function ID() { return new MetaField(XType::ID); }
	public static function String() { return new MetaField(XType::String); }
	public static function Integer() { return new MetaField(XType::Integer); }
	public static function NullableInteger() { return new MetaField(XType::NullableInteger); }
	public static function Boolean() { return new MetaField(XType::Boolean); }
	public static function NullableBoolean() { return new MetaField(XType::NullableBoolean); }
	public static function DateTime() { return new MetaField(XType::DateTime); }
	public static function Time() { return new MetaField(XType::Time); }
	public static function TimeSpan() { return new MetaField(XType::TimeSpan); }
	public static function Lemma() { return new MetaField(XType::Lemma); }
	
	public static function Slave($classname, $hookfield){ return new MetaSlave($classname,$hookfield); }
}


?>